package com.nbgroup.service.impl;

import com.nbgroup.mapper.SystemDeptMapper;
import com.nbgroup.pojo.Dept;
import com.nbgroup.pojo.dto.DeptDto;
import com.nbgroup.service.SystemDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class SystemDeptServiceImpl implements SystemDeptService {

    @Autowired
    private SystemDeptMapper systemDeptMapper;

    @Override
    public List<Dept> deptList(DeptDto dto) {
        return systemDeptMapper.deptList(dto);
    }

    @Override
    public Dept deptInfo(Integer deptId) {
        return  systemDeptMapper.deptInfo(deptId);
    }

    @Override
    public void update(Dept dept) {
        systemDeptMapper.update(dept);
    }

    @Override
    public void insert(Dept dept) {
        dept.setCreateTime(LocalDateTime.now());
        dept.setUpdateBy("admin");
        systemDeptMapper.insert(dept);
    }

    @Override
    public void delete(Integer deptId) {
        systemDeptMapper.delete(deptId);
    }


}
